package ua.eug.tst2;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.input.GestureDetector;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Touchable;

public class Test2 extends ApplicationAdapter{

	Stage stage;
	
	@Override
	public void create () {
		AssetLoad al = new AssetLoad();
		stage = new Stage();
		
		//MyController mc = new MyController();
		
		Toolbox tbox = new Toolbox();
		Schematic sch = new Schematic();
		sch.setTouchable(Touchable.enabled);
		stage.addActor(tbox);
		stage.addActor(sch);
		
		GestureDetector gd = new GestureDetector(sch);
		InputMultiplexer im = new InputMultiplexer(gd, stage);
		Gdx.input.setInputProcessor(im);
	}

	@Override
	public void dispose() {
		stage.dispose();
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(0.96f, 0.96f, 0.8f, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
		stage.draw();
	}

}
